package com.mjh.zhujianju.enums;

/**
 * @author liuyang
 * @Description: 业务类型枚举
 * @date 2018/8/11 10:09
 */
public enum BusinessEnum {
    TYPE_WORKDYNAMIC("1","动态"),
    TYPE_POLICY("2","政策"),
    TYPE_PERMISSION("3","权限"),
    TYPE_ANNOUNCEMENT("4","公告"),
    TYPE_ORGANIZATION("5","机构"),
    TYPE_DEPARTMENT("6","部门"),
    TYPE_REMOVE("7","拆迁户"),
    TYPE_WORKGUIDE("8","办事指南"),
    TYPE_BUILDING("9","党建"),
    TYPE_CLASS("10","课程"),
    TYPE_EVENT("11","活动"),
    TYPE_MEETING("12","会议"),
    TYPE_DEPT_USER("13","部门人员"),
    TYPE_LETTER("14","信访");


    private String code;
    private String name;

    BusinessEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static BusinessEnum[] getEnums(){
        return BusinessEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (BusinessEnum businessEnum : BusinessEnum.values()){
            if(code.equals(businessEnum.getCode())){
                return businessEnum.getName();
            }
        }

        return null;
    }
}
